
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>H5地理位置Demo</title>
          <script src="http://api.map.baidu.com/api?v=1.3" type="text/javascript">
          </script>
  
</head>
<body>
    <div  id="aaa" style="border:#ccc solid 1px" width:"697px" height:"500px"></div>
    <script type="text/javascript">
    if(navigator.geolocation)
    {
        navigator.geolocation.getCurrentPosition(function (p) {
            var latitude = p.coords.latitude//纬度
            var longitude = p.coords.longitude;
            
          
        }, function (e) {//错误信息
            var aa = e.code + "\n" + e.message;
            alert(aa);
        }
        );
    }
</script>
</body>
</html>
